Method and apparatus for processing and determining the orientation of documents

ABSTRACT

An apparatus is provided for determining the orientation of documents based upon the acquisition of images of the documents and the detection of barcode images from the documents. A document transport conveys documents along a selected path of movement. A document imaging system is provided along the path of movement for imaging a document conveyed along the path of movement to generate image data representative of the document. A system controller processes the image data to detect the presence of a barcode image. The location and/or orientation of the barcode image is then used to determine the orientation of the document along the path of movement. A document orientor may be provided along the path of movement to orient documents into desired orientations along the path of movement based upon the location and/or orientation of the detected barcode images.

CROSS-REFERENCED TO RELATED APPLICATION

[0001] This application is a continuation of application Ser. No.08/899,433, filed Jul. 24, 1997, which claimed priority to ProvisionalApplication No. 60/022,709, filed Jul. 26, 1996. The aforementionedprovisional application is hereby incorporated herein by reference.

FIELD OF THE INVENTION

[0002] The present invention relates to a method and apparatus forprocessing and determining the orientation of documents and, moreparticularly, to a method and apparatus for determining the orientationof documents based upon the detection of barcodes on the documents.

BACKGROUND OF THE INVENTION

[0003] Automated and semi-automated machines have been employed forprocessing documents such as bulk mail. Due to the large quantity ofmail received by many companies, there has long been a need forefficient sorting of incoming mail. Document sorting has becomeparticularly important in the area of remittance processing.

[0004] Utility companies, phone companies, and credit card companiesroutinely receive thousands of payment envelopes from their customers ona daily basis. Typically, a customer payment envelope contains aninvoice stub and some type of customer payment, usually in the form of abank check or money order.

[0005] In order to perform remittance processing, the remittancetransaction is initially extracted from the envelope. In some instances,the extraction may be done manually. In other instances, the extractionmay be done in an automated manner. Regardless of the manner in whichthe remittance transactions are extracted, further processing of theinvoices and accompanying checks is still required before remittanceprocessing can be effected.

[0006] Remittance processing equipment typically requires each batch ofremittance transactions to be organized so that each invoice-check pairis properly ordered and oriented. For example, conventional remittanceprocessing equipment may require each transactional pair of documents tobe ordered so that the invoice is positioned in front of or on top ofeach check. Furthermore, each invoice and each check must be oriented ina right-side-up, face-forward orientation. To determine the orientationof checks, magnetic imaging devices have been utilized to detect thelocation of the MICR line on the checks. Because the location of theMICR line is generally fixed, the magnetic imaging modules can determinethe orientation of a check based on the location of the MICR line.However, documents such as invoices do not include a MICR line, and theprinting on invoices varies widely among the different companies issuinginvoices.

[0007] In accordance with the present invention, an apparatus and methodare provided for detecting the orientation of documents based upon thedetection of a POSTNET code printed on the documents and for thereafterreordering and reorienting the documents, as necessary, for subsequentremittance processing.

SUMMARY OF THE INVENTION

[0008] The present invention relates to a method and apparatus forprocessing documents. More specifically, the present invention relatesto a method and apparatus for determining the orientation of documentsbased upon the acquisition of document images and the detection of aselected marking image such as a barcode image from the documents.

[0009] The apparatus in accordance with the present invention includes adocument transport for conveying documents along a selected path ofmovement. A document imager functions to acquire an image of a documentconveyed along the selected path of movement. Image data representativeof the document is stored by the document imager to provide a documentimage. A system controller is provided for processing the image data.More specifically, the system controller scans the stored document imagealong a selected scan line until a mark is detected. A mark may bedetected at an area of light transition in the document image. Next, thesystem controller scans the image along a vertical scan line in aselected vertical direction from the mark until a selected lighttransition point is detected. Next, the system controller scans theimage from a selected starting point located at a selected horizontaldistance from the light transition point along a horizontal scan linethrough the light transition point. The system controller thendetermines the light transition pattern along the horizontal scan lineto detect the presence of a barcode image. The system controller thendetermines the orientation of the document based on the barcode image.The orientation of the barcode image may be utilized to determine theorientation of the document. In another application, the detection ofthe location of barcode image at selected symmetrical areas on thedocument may be used to determine document orientation.

[0010] Pursuant to the method of the present invention the document isimaged to acquire image data representative of the document. The imagedata is then stored to provide a document image. The image is thenscanned along a selected line until a mark is detected. Next, the imageis scanned along a vertical scan line in a selected vertical directionfrom the mark until a selected light transition point is detected. Theimage is scanned along a horizontal scan line for a selected distance ina horizontal direction through the transition point. For this purpose, aselected horizontal scan starting point may be selected at a selectedhorizontal distance from the light transition point. The lighttransition pattern along the horizontal scan line is then determined todetect the existence of a barcode image. The orientation of the documentis then determined based upon the detection of the barcode image. Forexample, the orientation of the document may be determined based uponthe orientation of the detected barcode. Alternatively, documentorientation may be determined based upon the detection of a barcodeimage at selected symmetrical areas of the document.

BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The foregoing summary, as well as the following detaileddescription of the preferred embodiments of the present invention, willbe better understood when read in conjunction with the appendeddrawings, in which:

[0012]FIG. 1 is a block diagram showing the flow of documents through anautomated document processing apparatus in accordance with the presentinvention;

[0013]FIG. 2 is a block diagram showing the flow of data according tothe fixed position analysis;

[0014]FIG. 3 is the front face of an envelope illustrating the scannedareas used in the fixed position analysis;

[0015]FIG. 4 is an enlarged fragmentary view of one of the scanned areasfor the envelope illustrated in FIG. 3;

[0016]FIG. 5 is a block diagram showing the flow of data according to awide area scan;

[0017]FIG. 6 is the front face of an envelope illustrating a diagramscan line used when applying the wide area barcode scan;

[0018]FIG. 7 is an enlarged fragmentary view of a portion of theenvelope illustrated in FIG. 6; and

[0019]FIG. 8 is an enlarged view of a POSTNET barcode in an upside downorientation.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0020] Referring now to the drawings in general and FIG. 1 specifically,an apparatus 10 for processing documents that have a pre-printed POSTNETbarcode is illustrated. By determining the presence and location ororientation of the POSTNET barcode on a document, the apparatus is ableto determine the orientation of the document.

[0021] After determining the orientation of the document, theorientation detector can then cooperate with a machine capable ofselectively reorienting and sorting documents such as the model 150 mailsorting machine sold by Opex Corporation.

[0022] Referring now to FIG. 1, to begin processing a stack ofdocuments, the documents are placed in a feeder 20. The documents mayinclude transactional pairs of documents such as invoices andcorresponding checks to be oriented and ordered for remittanceprocessing. A system transport conveys the documents to an imagingmodule 30, which scans selected documents in the document flow, such asinvoices, to obtain image data representative of the documents. Theimage data is communicated with an image processor 70, which analyzesthe image data for each selected document to determine the orientationof the documents. The image controller 70 communicates the orientationinformation to a system controller 95. The system controller 95 is amicroprocessor that controls the operation of the apparatus in responseto signals received from the various components of the apparatus.

[0023] From the imaging module the system controller 95 controls theflow of the documents to selectively reorient the documents in responseto the orientation data for each document received from the imagingmodule 70. To reorient the documents, the documents are first conveyedto a reverser 40 that selectively reorients the documents by reversingthe leading and trailing edges of select documents to flip the documentsfrom front to back. The documents are then conveyed to a twister thatselectively reorients documents by rotating select documentshorizontally to twist the documents from top to bottom and from front toback. The system transport 75 conveys the oriented documents to astacker, which sorts and stacks the documents into bins.

[0024] Fixed Position Barcode Orientation Detection

[0025] Referring now to FIGS. 1 and 2, the orientation detector 10operates in a series of steps to determine the orientation of adocument. In the first step, a system transport 75 conveys a document toan imaging module 30 to scan the image of the document. The imagingmodule includes at least one, and preferably two high speed CCD linescan cameras 32 and 34. The cameras are disposed on opposing sides ofthe system transport 75 to acquire image data representative of bothfaces of each document passing through the imaging module 30.

[0026] The cameras 32 and 34, image a document by scanning the documentalong a series of lines to determine the light intensity at variouspoints or pixels on each line. The cameras are matched to the speed ofthe system transport 75 to obtain an image resolution of at leastapproximately 80 dpi×80 dpi. The light intensity of each pixel isrepresented by a gray scale number ranging from 0 (black) to 255(white). In step 2 the image data acquired for a document iscommunicated with an image processor 70. The image processor includes amicroprocessor 72 and a memory 74 sufficient to store the image data forat least two documents. The image processor receives the image data fromthe cameras 32, 34 and stores the data in memory 74. The microprocessor72 analyzes the image data for a document that is in the memory 74 todetermine the orientation of the document as is further discussed belowin steps 3 through 16. While the microprocessor is analyzing the data inthe memory, image data for the next document in the flow of documents isreceived by the image processor 70 and stored in memory. Once the imageprocessor has completed analyzing the image data for a document, theimage data is overwritten by the data for the next image to allowcontinuous processing and storage of image data.

[0027] In step 3, the image processor 70 begins analyzing the image datafor a particular document by selecting a scan area. Scan areas representareas of the image in which the POSTNET barcode for a particular type ofdocument may appear. The POSTNET barcode (“barcode”) representsinformation such as a zip code that the United States Postal serviceuses to sort mail. Companies print the barcode on documents andenvelopes because the United States Postal Service charges lower postagerates when the barcode is preprinted on the document to be delivered.

[0028] The scan areas are located so that the barcode for a particulardocument will only appear in one of the scan areas, depending on theorientation of the document. Therefore, once the image processordetermines the area in which the barcode is located, the orientation ofthe document can be determined. The scan area locations are based on thelocation of the barcode on the document, which can vary from document todocument. Therefore, the location of the scan areas is particular to thedocument being processed. For example, an invoice 100 from an utilitycompany may have a barcode 102 pre-printed above the address so that thescan areas are located as shown in FIG. 3. An invoice from a cablecompany may have the barcode located below the address. Therefore, thescan areas for the cable invoice are located in different positions thanscan areas for the utility invoice so that the invoices from the utilitycompany are grouped together and processed separately from the cableinvoices.

[0029] Referring now to FIG. 3, the scan areas operate similar to atemplate defining areas in which the barcode can appear. In other words,if a template is placed over the document, the scan areas are windowsthrough which the barcode would be visible if the barcode is present onthe document. Therefore, to define the scan areas, the location of thebarcode for a particular type of document must be known. For example,referring to FIG. 3, a barcode 102 is pre-printed on the invoice 100above the return address for the utility company so that for everyinvoice that the utility company sends to its customers on this form ofinvoice, the location of the barcode is fixed. For the invoice 100 shownin FIG. 3, the first scan area 110 is located in the area in which thebarcode is located if the invoice is oriented right-side-up facingforward. The second scan area 112 is located symmetrically to the firstscan area about the center point 104 of the invoice. In this way, thebarcode 102 will be located in the second scan area 112 if the invoiceis oriented upside-down facing forward. These two scan areas 110 and 112define the areas that are analyzed for the image of a face of a documentscanned by the first camera 32. A similar pair of scan areas 114 and 116define the areas that are analyzed for the image of the opposite face ofthe document scanned by the second camera 34. The second pair of scanareas 114 and 116 are located symmetrically to the first scan areas 110and 112 about the horizontal 106 or vertical 108 center lines of thedocument. In this way, if the document is oriented facing backward, thebarcode 102 will appear in one of the second pair of areas 114 and 116.If the document is oriented right-side-up facing backward the barcode102 will appear in scan area 116. If the document is orientedupside-down facing backward the barcode 102 will appear in scan area114. All four of the scan areas 110, 112, 114, and 116 are the same sizeand each area is larger than the size of the barcode 102 pre-printed onthe document. The larger size compensates for variations in the positionof the documents, which leads to variations in the position of thebarcode as the documents are processed.

[0030] In step 4, the image processor 70 checks whether all four scanareas 110, 112, 114, and 116 have been scanned. If all four scan areashave been analyzed and the barcode has not been identified, then theimage processor 70 indicates that the orientation was not determined andcommunicates this information to the system controller 95. The systemcontroller 95 then electronically tags the document as having anundetermined orientation and directs the document to a reject bin. Ifall four scan areas 110, 112, 114, and 116 have not been selected, thenthe image data for the scan areas selected in step 3 are analyzed by theimage processor 70 to determine whether the barcode is located in thescan area.

[0031] According to step 5, the image processor selects a scan line 120within the scanned area selected in step 3. The scan line is a lineextending through the scanned area that the image processor analyzes todetermine whether the line intersects the barcode. Although theorientation of the scan line can vary, in the present instance the scanline 120 extends away from the upper edge of the scanned area 110 at anangle of 45° as is shown in FIG. 4 which is an enlarged view of the scanarea 110 in FIG. 3. The first scan line in an area extends from theupper leading edge of the scan area and successive scan lines are spacedapart approximately one inch. A horizontal scan line can be used, butthe spacing between adjacent scan lines must be less than the height ofthe tall bars in the barcode to ensure that the barcode does not fallwithin adjacent scan lines, which would result in a failure to locatethe barcode. Similarly a vertical scan line can be used, but the spacingbetween adjacent scan lines must be less than the width of the bars inthe barcode to ensure that the barcode does not fall within adjacentscan lines. In addition, a scan line having an angle other than 45° canbe used, but the number of scan lines required to scan an area isincreased relative to when a 45° angle is used.

[0032] In step 6, the image processor determines whether the entire scanarea has been scanned by scan lines. If the entire area has been scannedthen the image processor selects another scan area as described in step3. If the entire scan area has not been scanned, the image processor 70proceeds to step 7.

[0033] The image processor analyzes the pixels on the scan line 120 insteps 7, 8, and 9 to determine whether the scan line intersects a darkpixel which would indicate the presence of a mark. In step 7, the imageprocessor identifies the first two pixels on the scan line andidentifies the gray level for the pixels. As described below in step 9the image processor analyzes the gray level for the pixels to determineif the second pixel represents a mark. If a pixel does not represent amark, the image processor progresses along the scan line analyzingsuccessive pixels until a mark is detected or the end of the scan lineis reached. If the image processor reaches the end of a scan linewithout detecting the barcode, the image processor selects another scanline as described above in step 5.

[0034] Step 9 identifies whether a pixel indicates the presence of amark. A local area threshold is utilized to determined whether a pixelis a mark. According to this method, the image processor compares thelight intensity of a pixel with the light intensity of the adjacentpreceding pixel along the scan line 120. If the light intensity of thesecond pixel is less than the light intensity of the first pixel by aspecified parameter, then the second pixel is designated as a mark andprocessing continues according to step 10. Otherwise, the imageprocessor continues along the scan line 120 to the next pixel, which isthen compared to the preceding pixel. The specified parameter that isused to compare successive pixels can be set forth in terms of thenumerical difference in gray scale levels or the percentage differencein gray scale levels. In the present instance, the specified parameteris a gray scale difference of 30%. For example, if the gray scale levelsof the first and second pixels along a scan line are 150 and 140respectively, the gray scale of the second pixel is not 30% less thanthe first pixel, so the second pixel is not designated as a mark. If thegray scale level of the third pixel along the is 95, then the thirdpixel is designated as a mark because the third pixel is more then 30%darker than the second pixel.

[0035] After a mark is detected, the image processor 70 attempts to findthe “bottom” of the mark. As illustrated in FIG. 4, if the diagonal scanline 120 crosses the barcode at point A, point A is indicated as a mark.As will be discussed later in steps 13-15, a horizontal line 130 isscanned to determine whether the barcode is present. If the horizontalscan line is located at point A, then the horizontal scan line 130 willnot pass through the small bars in the barcode. Consequently, thetransition pattern will not be properly identified and the imageprocessor will determine that point A is not part of a barcode.Therefore, the image processor scans vertically in an attempt to findthe bottom of the mark to determine whether the mark is part of thebarcode. If the mark is a barcode, then by finding the bottom of themark, the horizontal scan line will pass through the short bars as wellas the tall bars so that the transition pattern can be properlyidentified.

[0036] Whether the image processor scans up or down to find the bottomof the mark depends on which scan area the image processor is analyzing.For example, referring to FIG. 3, if a document is in a right-side-uporientation the barcode 102 will appear in either scan area 110 or 116depending on whether the document is facing forward or facing backward.If the document is right-side-up then the barcode 102 is alsoright-side-up. Therefore, if a point on the barcode is identified, thebottom of the barcode can be identified by moving vertically downward.Conversely, if the image processor is analyzing scan areas 114 or 116,the bottom of the barcode is located by moving vertically upward.Referring to the example in FIG. 4, the scan area being analyzed is scanarea 110. Therefore the image processor 70 analyzes the data byprogressing vertically pixel by pixel from point A toward point B.

[0037] In step 11, the bottom of the mark is identified by using a localarea threshold similar to that used in step 9. In step 11, the imageprocessor progresses vertically comparing the light intensity ofadjacent pixels. However, the image processor progresses along thevertical scan line until a transition from dark to light is detected,whereas in steps 7-9, the image processor progressed until a transitionfrom light to dark was detected. In this way, the image processor 70compares the intensity of the pixel identified as a mark in step 9 (i.e.point A) with the light intensity of the pixel that is verticallyadjacent in the direction of the bottom of the mark. If the lightintensity of the vertically adjacent pixel exceeds the light intensityof the first pixel (i.e. point A) by a specified parameter then a darkto light transition is detected and the image processor determines thatthe pixel is the bottom of the mark. The image processor then proceedsto step 12. In FIG. 4, the transition from dark to light indicating thebottom of the mark is designated point B. Conversely, if the lightintensity of the vertically adjacent pixel does not exceed the lightintensity of the first pixel by a specified parameter then the pixel isconsidered to be part of the mark identified in step 9 (i.e. point A).The image processor then continues to progress vertically to the nextpixel toward the bottom of the mark as detailed in step 10. In this way,the image processor proceeds from point A to point B, comparing thelight intensities of adjacent pixels.

[0038] According to step 12, once the bottom of the mark is located, theimage processor shifts a predetermined distance horizontally away fromthe leading edge of the scan area. The horizontal shift is approximatelyone inch to a point designated C in FIG. 4.

[0039] In step 13, starting from the point at which the image processorhorizontally shifted, the image processor scans horizontally in thedirection of the point located at the bottom of the mark, until theimage processor reaches the edge of the scan area. In other words, asillustrated in FIG. 4, the image processor scans the image dataproceeding horizontally from point C toward point B along line 130 untilthe image processor reaches the edge of the scan area designated atpoint D.

[0040] In step 14, the image data acquired during step 13 is used todetermine a transition pattern. The transition pattern reflects both thewidth of each mark as well as the width of the blank area or spacesbetween the marks. For example, referring again to FIG. 4, if each ofthe bars in the barcode is three pixels wide and each of the spaces isthree pixels wide, the transition pattern would reflect the width of thebars and the width of the spaces between the bars.

[0041] To determine the transition pattern along the horizontal scanline 130, the image processor 70 applies a modified local area thresholdto compare successive pixels along the scan line. The image processoranalyzes the successive pixels along the scan line 130 to determineareas in which the darkness is increasing. For this purpose, the imageprocessor uses a pair of counters, one counter for monitoring areas inwhich the darkness is increasing, referred to as a bar counter, and asecond counter for monitoring areas in which the darkness is decreasing,referred to as a space counter. As the image processor analyzes the dataalong the scan line 130, the gray levels for successive pixels arecompared. If the gray scale number for a pixel is greater than the grayscale number for the preceding pixel along the scan line, then the imageprocessor determines that the darkness is decreasing. In response to thedecreasing darkness, the image processor increments the space counter byone. If the next successive pixel has a gray scale number that issmaller than the gray scale number for the preceding pixel, then theimage processor determines that the darkness is increasing. In responseto the increasing darkness, the image processor increments the barcounter by one. Further, if the darkness changes from being increasinglydarker to decreasingly darker, the image processor stores the numberthat is in the bar counter and then resets the bar counter. Similarly,if the darkness changes from being decreasingly darker to increasinglydarker, the image processor stores the number that is in the spacecounter and then resets the space counter.

[0042] The following example illustrates the steps taken by the imageprocessor to determine the transition pattern. Referring to FIG. 4,assume that each bar in the barcode is three pixels wide and the spacesbetween the bars are three pixels wide. As the image processor analyzesthe data for the barcode along the horizontal scan line 130 from pixelto pixel the image processor detects a point of increasing darkness whenit reaches the first bar in the barcode. At this point, the imageprocessor resets the space counter and increments the bar counter toone. As the image processor progresses to the second pixel in the firstbar, the darkness will likely increase again because middle pixel in abar is generally darker then the pixels at the sides of the bar.Therefore, the image processor increments the bar counter to two. Theimage processor then progresses to the third pixel. The third pixel islocated at the side of the bar, so that the third pixel is most likelybrighter than the middle pixel. Therefore, the image processor storesthe number in the bar counter, i.e. 2, resets the bar counter to zero,and increments the space counter to 1. The image processor thenprogresses to the next pixel which is the first pixel in the spacebetween the bars. The space will be brighter than the preceding pixel onthe bar, so the image processor increments the space counter to two. Theimage processor continues along the horizontal scan line in this way toobtain a transition pattern.

[0043] By using the above transition detection technique, a standardtransition pattern for a barcode can be determined. The transitionpattern for a series of characters, such as number and/or letter in anaddress, may be similar to the transition pattern for a barcode for acertain portion along a horizontal scan line. For example, a series ofcharacters may match the transition pattern that represent ten bars inthe barcode. However, if the transition pattern for a given scan linemust match the transition pattern that represents twenty bars in abarcode, it is unlikely that the transition pattern for a characterstring will match the barcode transition pattern. In other words, as thenumber of bars represented in the predefined transition pattern isincreased, the likelihood of obtaining a matching transition patternthat is not a barcode decreases.

[0044] In step 15, the transition pattern determined in step 14 iscompared with a predetermined transition pattern which reflects abarcode transition pattern. If the transition pattern determined in step14 matches the barcode pattern, then the image processor proceeds tostep 16. If the pattern does not match the barcode pattern, the imageprocessor returns to step 7. More specifically, if the pattern is not abarcode, the image processor returns to point A on the diagonal scanline 120 and continues to proceed along the diagonal scan line to findanother mark.

[0045] In step 16, the orientation of the document is determined. Aspreviously detailed, the scan areas are located so that the barcode willonly appear in a single scan area. Therefore, the image processordetermines the orientation of a document based upon the scan area inwhich the barcode for the document was located. Once the orientation ofa document is determined, the image processor communicates a signal withthe system controller 95 indicating the orientation of the document. Thesystem controller then electronically tags the document so that thedocument is processed accordingly. In this regard, if the apparatusincludes a reorientor, the system controller monitors the progress ofthe documents to selectively reorient the documents by selectivelyreversing and/or twisting the documents in response to the orientationinformation from the image processor.

[0046] Wide Area Barcode Orientation Detection

[0047] In accordance with the foregoing, the apparatus detected theorientation of a document based on the supposition that the barcode waslocated in a fixed position on the document. Based on this supposition,the image data for a given document can be analyzed at four discretelocations to determine the orientation of the documents rather thananalyzing the image data for the entire document. However, in manycircumstances the location of the barcode is not fixed. For example,when a group of invoices from different companies are processed togetheror when different style invoices from the same company are processedtogether the location of the barcode may not be fixed. In suchinstances, the data analysis is not restricted to predetermined portionsof the image data. A wide area barcode orientation analysis (“wide areaanalysis”) is applied wherein the entire document is analyzed to detectthe location of the barcode. Once the barcode is located, theorientation of the barcode which corresponds to the orientation of thedocument, is then determined. In this way, the orientation of a documentcan be determined without knowing the location of the barcode on thedocument prior to processing the document.

[0048] The first two steps of the wide area analysis are similar to thefirst two steps in the previously described fixed position barcodeorientation detection analysis (“fixed position analysis”). The cameras32 and 34 scan a document to acquire a set of image data representativeof the document. The image data is communicated with the image processor70, which stores the image data in memory 74.

[0049] In step 3, the image data acquired by one of the cameras 32, 34representative of a face of the document is selected. If both faces ofthe document have been analyzed and a barcode was not detected, then theimage processor indicates that the orientation was not determined. Theimage processor 70 communicates this data to the system controller 95,which electronically tags the document as having an undeterminedorientation and directs the document to a reject bin. If both faces havenot been selected, then the image data for the face selected in step 3is analyzed by the image processor to determine whether the barcode islocated on the selected face.

[0050] Step 5 of the wide area analysis is similar to step 5 of thefixed position analysis. The image processor 70 selects a scan line 150on the face selected in step 3. The scan line is a line extendingthrough the selected face. The image processor analyzes the points alongthe scan line 150 to determine whether the scan line intersects thebarcode 102. Although the orientation of the scan line can vary, in thepresent instance the scan line extends away from the upper edge of theselected face at an angle of 45° as is shown in FIG. 6. When a 45° scanline is used, successive scan lines are spaced apart approximately oneinch.

[0051] In step 6, the image processor determines whether the entire facehas been scanned by scan lines. If the entire face has been scanned thenthe image processor selects another face as described in step 3. If theentire face has not been scanned, the image processor 70 proceeds tostep 7.

[0052] In steps 7, 8, and 9 the image processor analyzes the pixelsalong the selected scan line 150 to determine whether the scan lineintersects a mark. In step 7, the image processor moves along the scanline to the next pixel located on the scan line 150. In step 8, theimage processor checks to see if it has reached the end of the scanline. If the image processor reaches the end of the scan line withoutdetecting the barcode 102, the image processor selects another scan lineas described in step 5.

[0053] In step 9 the image processor determines whether the pixelidentified in step 7 represents a mark. To determine whether the pixelis a mark the image processor uses a local area threshold as describedin connection with step 9 in the fixed position analysis.

[0054] In step 10, the image processor scans vertically in an attempt tolocate the bottom of the mark detected in step 9. Step 10 is similar tostep 10 in the fixed position analysis except that in the wide scananalysis the image processor does not know which direction to govertically to find the bottom of the mark. Therefore, in step 10 of thewide scan analysis, the image processor moves vertically in a firstselected direction. In the example illustrated in FIG. 7, the imageprocessor moves vertically upward form point A toward point B.

[0055] Steps 11 through 15 are similar for both the wide scan analysisand the fixed location analysis. The image processor proceeds verticallyupward comparing successive pixels using a local area threshold. Oncethe image processor detects a transition from black to white, the imageprocessor shifts a predetermined distance horizontally away from theleading edge of the image. FIG. 7 illustrates this sequence in which theimage processor moves upward from point A to point E where a black towhite transition is detected. The image processor then shiftshorizontally to point F. The image processor then scans along ahorizontal line 155 toward the leading edge as indicated by point G. Asthe image processor scans horizontally the image processor detects thetransition pattern. In step 15, the transition pattern acquired byscanning along the horizontal line is compared with a predefinedtransition pattern indicative of a barcode, if the transition patternmatches the predefined pattern, the image processor determines that themark is a barcode and then proceeds to determine the orientation of thebarcode in step 16. If the transition pattern acquired in step 14 doesnot match the predefined pattern, then the image processor proceeds tostep 18 to attempt to locate a barcode.

[0056] In step 16, the image processor determines the orientation of thebarcode located in steps 1-15. The process for determining theorientation of the bar code is detailed below in reference to step 25.Similarly, the verification process in step 17 is detailed below inreference to step 26.

[0057] In step 18, the image processor shift back to the point along thescan line at which a mark was detected in step 9. In other words, theimage processor shifts from point G to point A in FIG. 7. The imageprocessor shifts back to point A to make a second attempt to find thebottom of the mark. As explained earlier, in the wide scan analysis, theimage processor does not know which way to proceed vertically to findthe bottom of a mark, unlike the fixed position analysis in which theimage processor knows which way to move vertically to find the bottom ofa mark. Therefore, when the image processor moved upward in step 10, theimage processor may have located the top of the mark and then determinedthe transition pattern for the top of the barcode, as illustrated inFIG. 7, when the image processor moved upward from point A to point E.In step 18, the image processor moves downward starting again from pointA.

[0058] In steps 19 and 20, the image processor moves downward in anattempt to locate the bottom of the barcode. The image processor movesdownward from point A comparing successive pixels using a local areathreshold to identify a transition as in steps 10 and 11. FIG. 7illustrates the sequence for the transition detection, wherein the imageprocessor moves vertically from point A to point B.

[0059] Proceeding to steps 21 through 24, once the image processorlocates the transition from black to white at point B, the imageprocessor shifts horizontally to point C and then scans along ahorizontal line 160 from point C toward the leading edge of the face, asindicated at point D. As the image processor moves along the horizontalline 160, the image processor analyzes the succeeding pixels todetermine the transition pattern along the horizontal line. If thetransition pattern matches a predefined transition pattern indicative ofa barcode, then the image processor determines that the mark is abarcode and the image processor proceeds to step 25 to determine theorientation of the barcode. If the transition pattern for the horizontalline does not match the predefined transition pattern, then the imageprocessor determines that the mark is not a barcode and the imageprocessor returns to step 7 and continues to move along the scan line150 to locate a mark.

[0060] When using the wide area scan, the barcode 102 on a document mayappear anywhere on the document. Therefore, determining the location ofthe barcode is not sufficient information to determine the orientationof the document. In step 25, the image processor analyzes the image datato determine the orientation of the barcode. The orientation of thebarcode is indicative of the orientation of the document because thebarcode is printed on documents in the same orientation as thedocuments. If the barcode is oriented right-side-up, the document isoriented right-side-up; and if the barcode is oriented upside down, thedocument is oriented upside down.

[0061] The orientation of a barcode refers to the direction in which thebars in the barcode extend. For example, as discussed previously, thebottom edge of the barcode in FIG. 7 is the edge intersecting the lineextending from point C to point D. When the bottom edge of the barcodeis below the top edge, the barcode is oriented upright, as illustratedin FIG. 7. Conversely, the barcode shown in FIG. 8 is oriented upsidedown because the bottom edge of the barcode is above the top edge.

[0062] To determine the orientation of a barcode identified in step 24,the image processor scans each bar to determine where each bar beginsand where each bar ends. The data acquired during the horizontal scan insteps 22 and 23 is used to locate each bar in the barcode 102. The imageprocessor then scans vertically along each bar using a local areathreshold, as discussed in step 10, to identify the transitions definingthe ends of each bar. In this way, the image processor determines whichbars are short bars and which bars are tall bars. By comparing the tallbars and the short bars, the image processor determines whether thebarcode is right-side-up or upside down.

[0063] Step 26 is a verification step that assures the mark identifiedis a barcode. Because the wide scan analysis is used to scan the entireface of a document, it may be possible for the image processor toencounter a group of marks or characters that have a transition patternsimilar to a barcode. Therefore, when applying the wide scan analysis,the image processor follows an additional step to verify that the markis a barcode. This verification step can also be included after step 15in the fixed location analysis to reduce the possibility of incorrectlydetermining the orientation of document.

[0064] The image processor verifies that the mark is a barcode bycomparing the number of tall bars to the number of short bars todetermine whether the ratio of tall bars to small bars matches apredetermined ratio based on standards used for POSTNET barcodes.According to United States Postal system specifications, POSTNETbarcodes are made up of a number of groups of bars. Each group of barshas five bars and each five-bar-group represents a single character,such as a number in a zip code. In addition, a tall bar 103 a is locatedat the beginning of the barcode and another tall bar 103 b is located atthe end of the barcode to indicate the ends of the barcode 102. Thesetwo tall bars, referred to as framing bars, are not used to representcharacters, i.e. the framing bars are separate from thefive-bar-groupings that indicate characters. The United States PostalService specifications further specify that each five bar groupings mustcontain three short bars and two tall bars. This ratio of two tall barsand three short bars for each five bar group is used as a parameter forverifying that a mark is a barcode. Accordingly, the image processor 70examines the data identified in step 25 to identify one of the framingbars 103 a, 103 b. The image processor then groups subsequent bars inthe barcode into five-bar-groups. Each five-bar-group is analyzed todetermine the ratio of tall bars to short bars. If each five-bar-grouphas two tall bars and three short bars, then the image processorverifies that the mark is a barcode.

[0065] If the ratio of short bars to tall bars varies from the 3:2ratio, the image processor may determine that the mark is not a barcodeand then return to point A in FIG. 7 and continue scanning along thescan line as described in step 7. However, when the image processoridentified the first framing bar, it may have incorrectly selected atall bar in one of the five bar groups, instead of a framing bar, sothat the five-bar-groupings were improperly determined. This may occurif the horizontal scan performed in steps 22 and 23 did not identify theentire width of the barcode. However, because the horizontal scan insteps 22 and 23 most likely identified at least one of the ends of thebarcode, the image processor makes a second attempt to find a framingbar if the first attempt led to a determination that the five bargroupings did not have the proper ratio of small bars to tall bars.

[0066] In the second attempt to locate a framing bar, the imageprocessor 70 analyzes the data identified in step 25 from the directionopposite the direction used in the first attempt. For example, if theimage processor examined the mark from left to right in the firstattempt to find a framing bar 103 a then the image processor 70 examinesthe mark from right to left in the second attempt. Once the imageprocessor identifies a mark that it determines is a tall bar, the imageprocessor designates that bar as a framing bar and then proceeds toseparate the bars into five bar groupings and check the ratio of smallbars to tall bars. If the small bar to tall bar ratio is 2:3, the imageprocessor designates the mark as a barcode and then proceeds to step 27.If the ratio is not 2:3, the image processor determines that the mark isnot a barcode and then returns to point A in FIG. 7 and continuesscanning along the scan line 150 as described in step 7.

[0067] In step 27, the image processor determines the orientation of thedocument based on the orientation of the barcode and the face on whichthe barcode was located. For instance, if the image processor locatesthe barcode on the face scanned by the first camera 32 and the barcodeis in the right-side-up orientation, then the image processor determinesthat the document is in the right-side-up facing forwarding orientation.The image processor then communicates the information with the systemcontroller 95, which electronically tags the document with theorientation data. The system controller then monitors the progress ofthe document through the apparatus and selectively reorients thedocument in accordance with the orientation data.

[0068] It will be recognized by those skilled in the art that changes ormodifications may be made without departing from the broad inventiveconcepts of the invention. It should therefore be understood that thisinvention is not limited to the particular embodiments described herein,but is intended to include all changes and modifications that are withinthe scope and spirit of the invention as set forth in the claims.

What is claimed is:
 1. A method for processing documents comprising thesteps of: A) imaging a document to acquire image data representative ofthe document; B) storing the image data for the document to provide adocument image; C) scanning the document image along a selected line inselected symmetrical areas of the document until a mark is detected; D)scanning along a vertical scan line in a selected vertical directionfrom the mark until a selected light transition point is detected; E)scanning along a horizontal scan line for a selected distance in ahorizontal direction toward the transition point; F) determining thelight transition pattern along the horizontal scan line; G) determiningwhether the light transition pattern conforms to a predetermined patternto detect the presence of a barcode image in a selected symmetricalarea; and H) determining the orientation of a document depending on theselected symmetrical area at which a barcode image is detected.
 2. Amethod for processing documents including the following steps: A)imaging a document to acquire image data representative of the document;B) storing the image data for the document to provide a document image;C) scanning the document image along a selected line until a mark isdetected; D) scanning along a vertical scan line in a selected verticaldirection from the mark until a selected light transition point isdetected; E) scanning along a horizontal scan line for a selecteddistance in a horizontal direction toward the transition point; F)determining the light transition pattern along the horizontal scan lineto detect the existence of a barcode image; G) determining theorientation of the barcode image; and H) determining the orientation ofthe document based on the determined orientation of the barcode image.3. An apparatus for processing documents comprising: A) a documenttransport for conveying documents along a selected path of movement; B)a document imager for imaging a document conveyed along the selectedpath of movement to provide a document image; C) a system controller forscanning the document image along a selected scan line until a mark isdetected, scanning the document image along a vertical scan line in aselected vertical direction from the mark until a selected lighttransition point is detected, scanning the document image along ahorizontal scan line for a selected horizontal distance toward the lighttransition point, determining a light transition pattern along thehorizontal scan line to detect the presence of a barcode image, anddetermining the orientation of the document based on the barcode image.4. An apparatus for processing documents comprising: A) a documenttransport for conveying documents along a selected path of movement; B)a document imager for imaging a document conveyed along the selectedpath of movement to provide a document image; C) a system controller forscanning the document image along a selected scan line in selectedsymmetrical areas of the document until a mark is detected, scanning thedocument image along a vertical scan line in a selected verticaldirection from the mark until a selected light transition point isdetected, scanning the document image along a horizontal scan line for aselected horizontal distance toward the light transition point,determining a light transition pattern along the horizontal scan line,determining whether the light transition pattern conforms to apredetermined pattern to detect the presence of a barcode image in aselected symmetrical area, and determining the orientation of thedocument based on the selected symmetrical area at which a barcode imageis detected.
 5. A method for processing documents, comprising the stepsof: A) Scanning a face of a document to acquire image data; B) Examiningthe image data to determine the presence of a mark; C) Analyzing themark to determine the presence of a bar code; D) Determining thelocation of the bar code; E) Determining the orientation of the barcode; and F) Determining the orientation of the document in response tothe determined location and orientation of the bar code.
 6. The methodof claim 5 comprising the step of scanning a second face of the documentand examining the image data of the second face to determine thepresence of a mark.
 7. The method of claim 5 wherein the step ofdetermining the orientation of the document comprises the step ofdetermining whether the document is in one of a pre-defined first orsecond orientation.
 8. The method of claim 5 wherein the step ofdetermining the orientation of the document comprises the step ofdetermining whether the document is in one of a pre-defined first,second, third or fourth orientation.
 9. The method of claim 5 whereinthe bar code includes an upper edge or a lower edge and the methodcomprises the step of locating the upper edge or the lower edge.
 10. Themethod of claim 5 comprising the step of selectively reorienting thedocument in response to the determined orientation of the document. 11.The method of claim 5 comprising the step of conveying the documentalong a document path, wherein the document is scanned to acquire imagedata while the document is conveyed along the document path.
 12. Amethod for processing documents comprising the steps of: A) Scanning aface of a document to acquire image data; B) Examining the image datafor first and second selected scanning areas of the document todetermine the presence of a mark; C) Analyzing the mark to determine thepresence of a bar code; E) Determining the orientation of the documentin response to the scanning area in which the bar code is detected. 13.The method of claim 12 wherein the scanning areas are symmetric aboutthe center point of the document.
 14. The method of claim 12 wherein thestep of examining the image comprises examining the image data for thirdand fourth scanning areas of the document to determine the presence of amark.
 15. The method of claim 14 wherein the third and fourth scanningareas are symmetric about the center point of the document.
 16. Themethod of claim 12 comprising the step of selecting a group of documentsfor processing wherein the selected documents have a commoncharacteristic.
 17. The method of claim 12 wherein the bar code has anupper edge or a lower edge and the method comprises the step of locatingthe upper edge or the lower edge.
 18. The method of claim 12 comprisingthe step of selectively reorienting the document in response to thedetermined orientation of the document.
 19. The method of claim 12comprising the step of conveying the document along a document path,wherein the document is scanned to acquire image data while the documentis conveyed along the document path.